<html><head><title>Samples a population to simulate a bottleneck</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="Rchm.css">
</head>
<body>

<table width="100%"><tr><td>bottleneck(LGS)</td><td align="right">R Documentation</td></tr></table><object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
<param name="keyword" value="R:   bottleneck">
<param name="keyword" value=" Samples a population to simulate a bottleneck">
</object>


<h2>Samples a population to simulate a bottleneck</h2>


<h3>Description</h3>

<p>
Given a population matrix or vector of haplotype counts, <code>bottleneck</code> reduces each count proportionally. In the context of microorganismsm, this function simulates events of sampling or random mortality.
</p>


<h3>Usage</h3>

<pre>
bottleneck(population= NULL, neck= NULL, keep.zero.count=FALSE)
</pre>


<h3>Arguments</h3>

<table summary="R argblock">
<tr valign="top"><td><code>population</code></td>
<td>
A matrix representing a population (rows= haplotypes, columns= loci plus an additional column of haplotype counts) or a vector of haplotype counts </td></tr>
<tr valign="top"><td><code>neck</code></td>
<td>
Total population size after culling. </td></tr>
<tr valign="top"><td><code>keep.zero.count</code></td>
<td>
Should haplotype with zero count be retained? If <code>FALSE</code> such haplotypes will be dropped from the returned population </td></tr>
</table>

<h3>Details</h3>

<p>
<code>bottlenck</code> calculates the expected number of clones after selection by multiplying the current number by a 'culling factor' code{neck/sum(haplotypeCounts)}. The realized number is given by a random number drawn from a poisoon distribution with expectation (/code{lambda}) given by the expected number of clones. Therefore, the final number <code>neck</code> is not exactly returned.
</p>


<h3>Value</h3>

<p>
If <code>population</code> is a population matrix, the same matrix with haplotype count updated by the bottlenck is returned. If <code>population</code> is vector of counts, a vector is returned accordingly.</p>

<h3>Author(s)</h3>

<p>
Dario Beraldi &lt;<a href="mailto:dario.beraldi@ed.ac.uk">dario.beraldi@ed.ac.uk</a>&gt;
</p>


<h3>Examples</h3>

<pre>
## An hypothtical vector of haplotype counts
hapCount&lt;- rpois(100, 10000)
bhap&lt;- bottleneck(hapCount, 1000, keep.zero.count=TRUE)
plot(hapCount, bhap)
</pre>



<hr><div align="center">[Package <em>LGS</em> version 0.91 <a href="00Index.html">Index]</a></div>

</body></html>
